﻿using FanaticUnitity.FfmpegZoomPictureTo300KB.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FanaticUnitity.FfmpegZoomPictureTo300KB
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(string.Join(" ", args));
            if (args.Length != 2)
            {
                Console.WriteLine("参数不合法，用法为: FanaticUnitity.FfmpegZoomPictureTo300KB \"你的ffmpeg.exe完整路径\" \"要压缩的图片路径\" ");
                Console.WriteLine("例子：FanaticUnitity.FfmpegZoomPictureTo300KB \"C:/ffmpeg.exe\" \"C:/test.png\"");
            }
            else
            {
                var ffmpeg = args[0];
                var filePath = args[1];

                if (FileHelper.IsImageFormat(filePath))
                {
                    FfmpegHelper.InitFfmpeg(ffmpeg);
                    //FfmpegHelper.GetImageSize(filePath);
                    var result = FfmpegHelper.CompressImage(filePath);
                    Console.WriteLine($"compressed: {result}");
                }

         
            }

#if DEBUG
            Console.ReadKey();
#endif

        }
    }
}
